package gold.digger;

import gold.utils.InputUtil;
import gold.vo.CodeDoc;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC268 {
    public long startExecuteTime = System.currentTimeMillis();

    public int missingNumber(int[] arr) {
        long supposeSum = (arr.length + 1) * arr.length / 2;
        for (int i = 0; i < arr.length; i++) {
            supposeSum -= arr[i];
        }

        return ((int) supposeSum);
    }


    public static void main(String[] args) throws Exception {
        LC268 an = new LC268();
        int[] arr = {9, 6, 4, 2, 3, 5, 7, 0, 1};
        System.out.println(an.missingNumber(arr));


        InputUtil.run();
        CodeDoc.run();
        System.out.println("\nanswer total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
